﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Sucdri.Domain.Model.MappingAttribute
{
   public enum TableRelationEnum
   {
      OneToOne,
      OneToMany,
      ManyToOne,
      ManyToMany
   } 


   [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
   public class FieldMappingAttribute : Attribute
   {

      private bool _isPrimaryKey;
      private string _fieldName;
      private DbType _fieldType;
      private bool _isForeignKey;
      private string _foreignTable;
      private TableRelationEnum _relationShip;
      private bool _autoIncrement;


      public FieldMappingAttribute(string fieldName,DbType fieldType)
      {
         _fieldName = fieldName;
         _fieldType = fieldType;
      }

      public bool IsPrimaryKey
      {
         get
         {
            return _isPrimaryKey;
         }
         set
         {
            _isPrimaryKey = value;
         }
      }

      public string FieldName
      {
         get
         {
            return _fieldName;
         }
         set
         {
            _fieldName = value;
         }
      }

      public DbType FieldType
      {
         get
         {
            return _fieldType;
         }
         set
         {
            _fieldType = value;
         }
      }

      public bool IsForeignKey
      {
         get
         {
            return _isForeignKey;
         }
         set
         {
            _isForeignKey = value;
         }
      }

      public string ForeignTable
      {
         get
         {
            return _foreignTable;
         }
         set
         {
            _foreignTable = value;
         }
      }

      public TableRelationEnum RelationShip
      {
         get
         {
            return _relationShip;
         }
         set
         {
            _relationShip = value;
         }
      }

      public bool AutoIncrement
      {
         get
         {
            return _autoIncrement;
         }
         set
         {
            _autoIncrement = value;
         }
      }
   }
}
